package ru.stool.erp.security;

import org.springframework.security.crypto.password.PasswordEncoder;

import ru.stool.erp.model.utils.PasswordUtils;

public class PasswordEncoderImpl implements PasswordEncoder {

	@Override
	public String encode(CharSequence password) {
		return PasswordUtils.getPasswordHash(password.toString());
	}

	@Override
	public boolean matches(CharSequence rawPassword, String encodedPassword) {
		String inputPass=PasswordUtils.getPasswordHash(rawPassword.toString());
		if(inputPass!=null && inputPass.equals(encodedPassword))
			return true;
		
		return false;
	}

	
}
